package com.lzk.controller;

import com.lzk.common.R;
import com.lzk.pojo.User;
import com.lzk.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.Map;

@RestController
@Slf4j
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;
    @PostMapping("/sendMsg")
    public R<String> sendMsg(@RequestBody User user, HttpSession session){
        log.info(user.toString());
        return userService.sendMsg(user,session);
    }
    @PostMapping("/login")
    public R<User> login(@RequestBody Map<String,Object> map,HttpSession session){
        log.info(map.toString());
        return userService.login(map,session);
    }
}
